<template>
	<!-- 审核详情 -->
  <scroll-view
    v-if="Object.values(renderForm).length"
    scroll-y="true"
    class="content"
  >
    <uni-section
      v-if="renderForm?.mainContentList?.length"
      :title="data.businessNo"
      type="line"
    >
      <template v-slot:right>
        <text v-if="dataOne.renderForm?.operable != '1'"
          >（该单据只能在电脑端审核）</text
        >
        <text class="todo" :class="color">
          {{ dataOne.approvalStatusName }}
        </text>
      </template>
      <uni-card
        v-for="(item, j) in renderForm?.mainContentList"
        :key="j"
        :title="item.name || '主申请信息'"
        class="card"
      >
        <text
          v-if="item?.columns?.length"
          class="card-item"
          v-for="(i, z) in item?.columns"
          :key="z"
          >{{ i.name }}：{{ dataOne[i?.field] }}</text
        >

        <view v-else class="no-data"> 暂无数据 </view>
      </uni-card>
      <uni-card
        v-if="renderForm?.descContentList?.length"
        v-for="(item, j) in renderForm?.descContentList"
        :key="j"
        :title="item.name || '次申请信息'"
        class="card"
      >
        <text
          v-if="item?.columns?.length"
          class="card-item"
          v-for="(i, z) in item?.columns"
          :key="z"
          ><text class="title">{{ i.name }}</text
          >：{{ dataOne[item?.field]?.[i?.field] }}</text
        >

        <view v-else class="no-data"> 暂无数据 </view>
      </uni-card>

      <uni-card
        v-if="renderForm?.tableContentList?.length"
        v-for="(item, j) in renderForm?.tableContentList"
        :key="j"
        :title="item.name || '详情信息'"
        class="card"
      >
        <view v-if="dataOne[item?.field]?.length">
          <view
            class="spec-item"
            v-for="(i, z) in dataOne[item?.field]"
            :key="z"
          >
            <view class="number"> 序号：{{ z + 1 }} </view>
            <text class="card-item" v-for="(ix, zx) in item.columns" :key="zx">
              <text class="title">{{ ix.name }}</text
              >：{{ i?.[ix?.field] }}</text
            >
            <!-- 明细里面的附件 -->
            <view v-if="i?.attachmentList?.length" style="flex-basis: 100%">
              <text class="font-bold">附件信息：</text>
              <view
                v-for="(x, z) in i?.attachmentList"
                :key="z"
                class="flex flex-j-between"
              >
                <text>{{ x?.attachmentName }}</text>
                <text
                  class="download"
                  @click="downloadFile(`${baseUrl}${x?.attachmentPath}`)"
                  >查看</text
                >
              </view>
            </view>

            <!--  -->
            <view
              v-if="displaySomeButton"
              class="action-detail"
              style="flex-basis: 100%"
            >
              <button
              v-if="data.billType==='BPCGSH'&&dataOne.approvalStatus==='0'"
                class="color-audit"
                @click="
                  skipTo('audit', { ...i, _columns_: item.columns} || {})
                "
              >
                编辑
              </button>
              <button
                class="color-confirm"
                @click="
                  skipTo('confirm', { ...i, _columns_: item.columns } || {})
                "
              >
                {{dataOne.approvalStatus==='1'?'查看供应商':'确认供应商'}}
              </button>
            </view>
          </view>
        </view>
        <view v-else class="no-data"> 暂无数据 </view>
      </uni-card>
      <GcsbInfo :dataOne="dataOne" :data="data"></GcsbInfo>

    </uni-section>

    <uni-section
      v-if="renderForm?.imgContentList?.length"
      title="认证信息"
      type="line"
    >
      <uni-grid :showBorder="false" :column="4">
        <uni-grid-item
          v-for="(item, j) in renderForm?.imgContentList"
          :index="j"
          :key="j"
        >
          <view class="flex-center">
            <image
              style="width: 75px; height: 75px"
              @click="
                showimg(`${baseUrl}${dataOne[item?.field]?.attachmentPath}`)
              "
              :src="`${baseUrl}${dataOne[item?.field]?.attachmentPath}`"
            >
            </image>
            <view class="sm-text">{{ item.name }}</view>
          </view>
        </uni-grid-item>
      </uni-grid>
    </uni-section>

    <uni-section
      v-if="dataOne?.attachmentList?.length"
      title="附件信息"
      type="line"
    >
      <uni-list>
        <uni-list-item
          ellipsis="1"
          v-for="(i, z) in dataOne?.attachmentList"
          :key="z"
          :title="i.attachmentName"
        >
          <template v-slot:footer>
            <text
              class="download"
              @click="downloadFile(`${baseUrl}${i?.attachmentPath}`)"
              >查看</text
            > 
          </template>
        </uni-list-item>
      </uni-list>
    </uni-section>
 
	<SaleBillDeductContent
	  :dataOne="dataOne"
	  :billType="data.billType"
	  @formValueChange="formValueChange"
	></SaleBillDeductContent>
	
	<OtherDeductContent
	  :dataOne="dataOne"
	  :billType="data.billType"
	  @formValueChange="formValueChange"
	></OtherDeductContent>
 
    <uni-section title="审核信息" type="line" v-if="hitTasksData?.length">
      <uni-list
        v-for="(item, j) in hitTasksData"
        :key="j"
        :title="item.taskName || '审核意见'"
      >
        <uni-list-item
          ellipsis="1"
          v-for="(value, index) in ApprovalInfo"
          :class="index === 0 ? 'bold-title-uni-list' : ''"
          :key="index"
          :title="value.title"
          :rightText="item[value.key]"
        />

        <uni-list-item
          ellipsis="1"
          v-for="(list, j) in item.taskAttachmentList"
          :key="j"
          :title="list.attachmentName"
        >
          <template v-slot:footer>
            <text
              class="download"
              @click="downloadFile(`${baseUrl}${list?.attachmentPath}`)"
              >查看</text
            >
          </template>
        </uni-list-item>
      </uni-list>
    </uni-section>
 
    <view
      v-if="data.isApproval == '1' && dataOne.renderForm?.operable == '1'"
      class="action"
    >
      <button
        :loading="loading"
        :disabled="loading"
        v-for="(j, index) in dataOne?.activitiInstance?.actions?.map(
          (e) =>
            dataOne?.activitiInstance?.actionDefList?.filter(
              (el) => e == el.value
            )[0]
        )"
        :key="index"
        :class="
          j.value === 'A'
            ? 'color-ok'
            : j.value === 'R'
            ? 'color-notOk'
            : 'color-okPlus'
        "
        @click="dialogShow(j.value)"
      >
        <text>{{ j.label }}</text>
      </button>
    </view>
  </scroll-view>

  <view v-else class="no-data"> 暂无数据 </view>
  <uni-popup ref="alertDialog" type="dialog">
    <uni-popup-dialog
      type="info"
      cancelText="关闭"
      class="dialog"
      confirmText="确定"
      :before-close="!comment"
      :title="
        dataOne?.activitiInstance?.hitTasks?.filter(
          (el) => el.taskApprovalStatus == '0'
        )[0].taskName
      "
      @confirm="dialogConfirm"
      @close="$refs.alertDialog.close()"
    >
      <uni-section title="附件信息" type="line">
        <lsj-upload
          ref="lsjUpload"
          childId="upload1"
          :width="width"
          :height="height"
          :option="option"
          :size="size"
          :instantly="instantly"
          @progress="progress"
        >
          <span class="chooseFile">选择文件</span>
        </lsj-upload>

        <view v-for="(item, index) in files" style="margin: 6px 0" :key="index">
          <text>{{ item.name }}</text>
          <text
            class="delete"
            style="margin-left: 8px"
            @click="clear(item.name)"
            >删除</text
          >
          <progress
            style="margin-top: 6px"
            show-info
            :percent="Number(item.progress)"
            stroke-width="3"
          />
        </view>
      </uni-section>
      <DialogContentVue
        :billType="data.billType"
        @formValueChange="formValueChange"
      ></DialogContentVue>
      <uni-section title="审批意见" type="line">
        <textarea
          style="font-size: 28rpx; height: 75px"
          v-model="comment"
          placeholder-style="color:#dfdfdf"
          placeholder="请输入审批意见"
        />
      </uni-section>
    </uni-popup-dialog>
  </uni-popup>
</template>

<script>
import { TOKEN } from "@/utils/auth";
import { downloadFile } from "@/utils/download";
import { baseUrl } from "@/utils/httpInterceptor";
import { Toast } from "@/utils/uniHooks/toast";
import {
  postActivitiesTaskApproved,
  postActivitiesTaskUnapproved,
  ApprovalInfo,
} from "./api";
import useNoticeMyToDoDetail from "./apiHooks";
import { poststoppageapproved, postSaleBillApproved, postWasteBillApproved,
 postQthtfkApproved,postClfkApproved,postFybxApproved} from "./displayFile/api";
import DialogContentVue from "./displayFile/dialogContent.vue";
import SaleBillDeductContent from "./displayFile/saleBillDeductContent.vue";
import OtherDeductContent from "./displayFile/otherDeductContent.vue";
import GcsbInfo from "./displayFile/gcsbInfo.vue";

export default {
  components: {
    DialogContentVue,
    GcsbInfo,
	SaleBillDeductContent,
	OtherDeductContent,
  },
  data() {
    return {
      data: {}, //路由参数
      dataOne: {},
      baseUrl,
      comment: "", //审核意见
      approveType: "", //审核类型
      ApprovalInfo,
      loading: false,
      formValue: {}, //额外的表单值
      option: {
        // 上传服务器地址，此地址需要替换为你的接口地址
        url: `${baseUrl}/attachment/temp/upload`,
        // 上传附件的key
        name: "file",
        // 根据你接口需求自定义请求头
        header: {
          Authorization: TOKEN(),
        },
        // 根据你接口需求自定义body参数
      },
      // 选择文件后是否立即自动上传，true=选择后立即上传
      instantly: true,
      // 必传宽高且宽高应与slot宽高保持一致
      width: "75px",
      height: "25px",
      // 限制允许选择的格式，空串=不限制，默认为空
      // formats: 'png,jpg,mp4',
      // 文件上传大小限制
      size: 10,
      // 文件回显列表
      files: {},
      billTypeName: "",
    };
  },

  computed: {
    getDetailData() {
      return useNoticeMyToDoDetail();
    },
    renderForm() {
      return this.dataOne?.renderForm || {};
    },
    hitTasksData() {
      if (this.data.isApproval == "1") {
        return this.dataOne?.activitiInstance?.hitTasks?.filter(
          (el) => el.taskApprovalStatus != "0"
        );
      } else {
        return this.dataOne?.activitiInstance?.hitTasks || [];
      }
    },
    color() {
      switch (this.dataOne.approvalStatus) {
        case "0":
          return "color-todo";

        case "-1":
          return "color-reject";

        case "1":
          return "color-done";

        default:
          return "";
      }
    },
    displaySomeButton() {
      switch (this.data.billType) {
        case "BPCGSH":
          return true;
		case "BPWXSH":
		  return true;
        default:
          return false;
      }
    },
  },
  onLoad: function (option) {
    uni.setNavigationBarTitle({
      title: option?.billTypeName || "详情",
    });
    this.billTypeName = option?.billTypeName;
	console.log("初始化数据",option)
    this.data = option;
  },

  onShow() {
    uni.showLoading({
      title: "加载中",
    });
    this.getDetail();
  },

  methods: {
    formValueChange(v) {
      //特殊的表单提交字段 将会放在dialogConfirm
      this.formValue = {...this.formValue,...v};
    },

    async specConfirm(p) {
	  let res;
      switch (this.data.billType) {
        case "TGJL": 
          res = await poststoppageapproved({
            ...p,
            ...this.formValue,
            reason: this.dataOne.reason,
          });
          return res;
		case "RZXS":
		case "SXXS":
		case "ZYXS":
		case "DXXS":
			res = await postSaleBillApproved({
			  ...p,
			  privateMerchantId: this.dataOne?.subAccountInfo?.privateMerchantId,
			  ...this.formValue,
			});
			return res;
		case "FLXS":
			res = await postWasteBillApproved({
			  ...p,
			  privateMerchantId: this.dataOne?.subAccountInfo?.privateMerchantId,
			  ...this.formValue,
			});
			return res;
		case "QTHTFK":
			res = await postQthtfkApproved({
			  ...p,
			  privateMerchantId: this.dataOne?.subAccountInfo?.privateMerchantId,
			  ...this.formValue,
			});
			return res;
		case "CLFKSQ":
			res = await postClfkApproved({
			  ...p,
			  privateMerchantId: this.dataOne?.subAccountInfo?.privateMerchantId,
			  ...this.formValue,
			});
			return res;
		case "FYBX":
			res = await postFybxApproved({
			  ...p,
			  privateMerchantId: this.dataOne?.subAccountInfo?.privateMerchantId,
			  ...this.formValue,
			});
			return res;
        default:
          return false;
      }
    },
    skipTo(type, item) {
		console.log("审核信息",type,item)
      switch (type) {
        case "audit":
          return uni.navigateTo({
            url: `/pages/todoList/specBillTypeFile/BPCGSH/audit?itemData=${JSON.stringify(
              item
            )}&billTypeName=${this.billTypeName}`,
          });

        case "confirm":
		  if(this.data.billType === 'BPCGSH'){
			 return uni.navigateTo({
			   url: `/pages/todoList/specBillTypeFile/BPCGSH/confirm?itemData=${JSON.stringify(
			     item
			   )}&billTypeName=${this.billTypeName}&approvalStatus=${this.dataOne.approvalStatus}`,
			 }); 
		  }else if(this.data.billType === 'BPWXSH'){
			  return uni.navigateTo({
			    url: `/pages/todoList/specBillTypeFile/BPWXSH/confirm?itemData=${JSON.stringify(
			      item
			    )}&billTypeName=${this.billTypeName}&approvalStatus=${this.dataOne.approvalStatus}`,
			  }); 
		  }
        default:
          return false;
      }
    },
    Toast,
    // 移除某个文件
    clear(name) {
      // name=指定文件名，不传name默认移除所有文件
      delete this.files[name];
      this.$forceUpdate();
    },

    progress(item) {
      // 更新当前状态变化的文件

      this.files[item.name] = item;
      this.$forceUpdate();
    },
    dialogShow(v) {
      this.$refs.alertDialog.open();
      this.approveType = v;
    },

    async dialogConfirm() {
      this.loading = true;

      const taskAttachmentList = Object.values(this.files).map((el) => {
        const { attachmentId, attachmentName } = JSON.parse(
          el?.responseText
        )?.data;
        return {
          attachmentId,
          attachmentName,
        };
      });

      let res;
      if (this.approveType != "R") {
        const p = {
          comment: this.comment,
          taskId: this.dataOne?.taskId,
          finalFlag: this.approveType == "A" ? "0" : "1",
        };
        if (taskAttachmentList.length) {
          p.taskAttachmentList = taskAttachmentList;
        }
        const specConfirmRes = await this.specConfirm(p);
        if (!specConfirmRes) {
          //如果不是特殊的通过
          res = await postActivitiesTaskApproved(p);
          //
        } else {
          res = specConfirmRes;
        }
      } else {
        if (!this.comment) {
          return Toast("请输入审批意见");
        }
        const p = {
          comment: this.comment,
          taskId: this.dataOne?.taskId,
        };
        if (taskAttachmentList.length) {
          p.taskAttachmentList = taskAttachmentList;
        }
        res = await postActivitiesTaskUnapproved(p);
      }

      if (res.code === "0") {
        Toast("操作成功");
        this.$refs.alertDialog.close();
        this.getDetail();
      } else {
        this.$refs.alertDialog.close();

      }
      this.loading = false;
	  this.comment=''
    },
    downloadFile,
    showimg(v) {
      uni.previewImage({
        urls: [v],
        longPressActions: {
          itemList: ["保存图片"],
          success: function (data) {
            downloadFile(v);
          },
          fail: function (err) {
            console.log(err.errMsg);
          },
        },
      });
    },
    getDetail() {
	  // 工伤鉴定
	  if(this.data.billType === "GSJD")
		this.getDetailData.workInjuryAppraisalRun(this.data.billId);
	  // 工伤报告
	  if(this.data.billType === "GSGL")
		this.getDetailData.workInjuryBillRun(this.data.billId);
      // 运费付款
      if (this.data.billType === "YFFK")
        this.getDetailData.freightPaymentQueryRecordRun(this.data.billId);
      //单据交接
      if (this.data.billType === "DJJJ")
        this.getDetailData.transferQueryIdRun(this.data.billId);
      // 采购合同
      if (this.data.billType === "CGHT")
        this.getDetailData.contractOfPurchaseRun(this.data.billId);
      // 代工合同
      if (this.data.billType === "DGHT")
        this.getDetailData.foundryRun(this.data.billId);
      // 销售合同
      if (this.data.billType === "XSHT")
        this.getDetailData.sellRun(this.data.billId);
      // 代工原材出库申请
      if (this.data.billType === "DGYCCKSQ")
        this.getDetailData.materialOemReturnRun(this.data.billId);
      // 热轧退货申请
      if (this.data.billType === "RZTHSQ")
        this.getDetailData.hotRolledReturnRun(this.data.billId);
      // 移库申请
      if (this.data.billType === "YKSQ")
        this.getDetailData.warehouseTransferRun(this.data.billId);
      // 主料入库单
      if (this.data.billType === "ZLRKD")
        this.getDetailData.warehousingRun(this.data.billId);
      // 备品新增申请
      if (this.data.billType === "BPWH")
        this.getDetailData.spareApplyRun(this.data.billId);
      // 备品采购申请
      if (this.data.billType === "BPCGSQ")
        this.getDetailData.purchaseApplyOrderRun(this.data.billId);
      // 酸洗计划
      if (this.data.billType === "SXJH")
        this.getDetailData.picklingPlanRun(this.data.billId);
      // 轧硬计划
      if (this.data.billType === "ZYJH")
        this.getDetailData.hardenedPlanRun(this.data.billId);
      // 镀锌计划
      if (this.data.billType === "DXJH")
        this.getDetailData.galvanizationPlanRun(this.data.billId);
      // 彩涂计划
      if (this.data.billType === "CTJH")
        this.getDetailData.colorCoatingPlanRun(this.data.billId);
      // 热轧销售
      if (this.data.billType === "RZXS")
        this.getDetailData.hotRolledSaleBillRun(this.data.billId);
      // 酸洗销售
      if (this.data.billType === "SXXS")
        this.getDetailData.picklingSaleBillRun(this.data.billId);
      // 轧硬销售
      if (this.data.billType === "ZYXS")
        this.getDetailData.hardenedSaleBillRun(this.data.billId);
      // 镀锌销售
      if (this.data.billType === "DXXS")
        this.getDetailData.galvanizationSaleBillRun(this.data.billId);
      // 彩涂销售
      if (this.data.billType === "CTXS")
        this.getDetailData.colorCoatingSaleBillRun(this.data.billId);
      // 备品分类新增申请
      if (this.data.billType === "BPFLWH")
        this.getDetailData.spareCategoryApplyRun(this.data.billId);
      // 辊子移库申请单
      if (this.data.billType === "GZYKSQ")
        this.getDetailData.gunZiWarehouseTransferBillRun(this.data.billId);
      // 轧辊移库申请单
      if (this.data.billType === "ZGYKSQ")
        this.getDetailData.zhaGunWarehouseTransferBillRun(this.data.billId);
      // 备品供应商审核
      if (this.data.billType === "BPGYSSH")
        this.getDetailData.supplierApplyRun(this.data.billId);
      // 备品其他入库申请
      if (this.data.billType === "BPQTRKSQ")
        this.getDetailData.spareStockInOtherApplyBillRun(this.data.billId);
      // 备品其他出库申请
      if (this.data.billType === "BPQTCKSQ")
        this.getDetailData.spareStockOutOtherApplyBillRun(this.data.billId);
      // 备品领用申请
      if (this.data.billType === "BPLYSQ")
        this.getDetailData.spareClaimBillRun(this.data.billId);
      // 备品退货申请
      if (this.data.billType === "BPTHSQ")
        this.getDetailData.spareReturnsApplyBillRun(this.data.billId);
      // 备品移库申请
      if (this.data.billType === "BPYKSQ")
        this.getDetailData.spareWarehouseTransferBillRun(this.data.billId);
      // 铁桶移库申请
      if (this.data.billType === "TTYKSQ")
        this.getDetailData.ironDrumWarehouseTransferBillRun(this.data.billId);
      // 轧辊轴承类移库申请单
      if (this.data.billType === "ZGZCYKSQ")
        this.getDetailData.bearingWarehouseTransferBillRun(this.data.billId);
      // 备品暂存出库申请单
      if (this.data.billType === "BPZCCKSQ")
        this.getDetailData.spareStagingStockOutApplyBillRun(this.data.billId);
      // 轧辊报废申请
      if (this.data.billType === "ZGBFSQ")
        this.getDetailData.zhaGunScrapApplyBillRun(this.data.billId);
      // 轧辊轴承类报废申请
      if (this.data.billType === "ZGZCBFSQ")
        this.getDetailData.zhaGunBearingScrapApplyBillRun(this.data.billId);
      // 辊子报废申请
      if (this.data.billType === "GZBFSQ")
        this.getDetailData.gunZiScrapApplyBillRun(this.data.billId);
      // 铁桶报废申请
      if (this.data.billType === "TTBFSQ")
        this.getDetailData.ironDrumScrapApplyBillRun(this.data.billId);
      // 修磨计划
      if (this.data.billType === "XMJH")
        this.getDetailData.zhaGunGrindPlanRun(this.data.billId);
      // 拉矫申请
      if (this.data.billType === "LJSQ")
        this.getDetailData.pullCorrectionBillRun(this.data.billId);
      // 备品采购审核
      if (this.data.billType === "BPCGSH")
        this.getDetailData.sparePurchaseAuditBillRun(this.data.billId);
      // 备品维修申请
      if (this.data.billType === "BPWXSQ")
        this.getDetailData.spareMaintenanceApplyBillRun(this.data.billId);
      // 备品维修审核单
      if (this.data.billType === "BPWXSH")
        this.getDetailData.spareMaintenanceAuditBillRun(this.data.billId);
      // 暂存货物出库申请
      if (this.data.billType === "ZCCKSQ")
        this.getDetailData.temporaryStorageProductApplyRun(this.data.billId);
      // 镀锌边角料处理申请
      if (this.data.billType === "DXBJLCLSQ")
        this.getDetailData.oemWastePurchaseBillRun(this.data.billId);
      // 备品领用退库单
      if (this.data.billType === "BPLYTK")
        this.getDetailData.spareClaimStockBackBillRun(this.data.billId);
      // 废料销售单
      if (this.data.billType === "FLXS")
        this.getDetailData.wasteSaleBillRun(this.data.billId);
      // 备品采购付款
      if (this.data.billType === "BPCGFK")
        this.getDetailData.sparePurchasePaymentBillRun(this.data.billId);
      // 处理付款申请
      if (this.data.billType === "CLFKSQ")
        this.getDetailData.disposePaymentBillRun(this.data.billId);
      // 备品采购退款
      if (this.data.billType === "BPCGTK")
        this.getDetailData.sparePurchaseRefundBillRun(this.data.billId);
      // 销售退货
      if (this.data.billType === "XSTH")
        this.getDetailData.saleReturnBillRun(this.data.billId);
      // 其他合同
      if (this.data.billType === "QTHT")
        this.getDetailData.otherContractRun(this.data.billId);
      // 其他合同发票申请
      if (this.data.billType === "QTHTFPSQ")
        this.getDetailData.otherContractInvoiceRun(this.data.billId);
      // 其他合同收款申请
      if (this.data.billType === "QTHTSK")
        this.getDetailData.otherContractFinanceRun(this.data.billId);
      // 其他合同付款
      if (this.data.billType === "QTHTFK")
        this.getDetailData.otherContractFinanceRun(this.data.billId);
      // 费用借款申请
      if (this.data.billType === "FYJK")
        this.getDetailData.comprehensivePaymentBorrowBillRun(this.data.billId);
      // 综合付款申请
      if (this.data.billType === "ZHFK")
        this.getDetailData.comprehensivePaymentPayBillRun(this.data.billId);
      // 费用报销申请
      if (this.data.billType === "FYBX")
        this.getDetailData.comprehensivePaymentExpenseBillRun(this.data.billId);
      // 重要物品领用申请
      if (this.data.billType === "ZYWPLY")
        this.getDetailData.importanceUseBillRun(this.data.billId);
      // 备品维修付款
      if (this.data.billType === "BPWXFK")
        this.getDetailData.spareMaintenancePaymentBillRun(this.data.billId);
      // 质量异议报告
      if (this.data.billType === "ZLYYBG")
        this.getDetailData.qualityProblemBillRun(this.data.billId);
      // 备品未尽数使用说明
      if (this.data.billType === "BPSYSM")
        this.getDetailData.spareUseRemainderBillRun(this.data.billId);
      // 拉矫付款申请
      if (this.data.billType === "LJFKSQ")
        this.getDetailData.correctionFinanceBillRun(this.data.billId);
      // 废料收款单
      if (this.data.billType === "FLSK")
        this.getDetailData.tradeWastesReceiptBillRun(this.data.billId);
      // 废料付款单
      if (this.data.billType === "FLFK")
        this.getDetailData.tradeWastesPaymentBillRun(this.data.billId);
      // 废料收款开票申请
      if (this.data.billType === "FLSKKPSQ")
        this.getDetailData.tradeWastesInvoiceApplyBillRun(this.data.billId);
      // 销售锁价开票申请
      if (this.data.billType === "XSHTKPSQ")
        this.getDetailData.saleContractInvoiceApplicationRun(this.data.billId);
      // 热卷合同
      if (this.data.billType === "RJHT")
        this.getDetailData.tradeReJuanContractRun(this.data.billId);
      // 热卷收款单
      if (this.data.billType === "RJSK")
        this.getDetailData.tradeReJuanContractBillRun(this.data.billId);
      // 热卷付款单
      if (this.data.billType === "RJFK")
        this.getDetailData.tradeReJuanPaymentBillRun(this.data.billId);
      // 热卷其它付款单
      if (this.data.billType === "RJQTFK")
        this.getDetailData.tradeReJuanOtherPaymentBillRun(this.data.billId);
      // 月结开票申请
      if (this.data.billType === "YJKPSQ")
        this.getDetailData.saleMonthlyInvApplicationRun(this.data.billId);
      // 客户审核
      if (this.data.billType === "KHSH")
        this.getDetailData.merchantApplyRun(this.data.billId);
      // 工程申报
      if (this.data.billType === "GCSB")
        this.getDetailData.projectDeclareRun(this.data.billId);
      // 转销售(加工)申请
      if (this.data.billType === "ZXSZJGSQ")
        this.getDetailData.materialPurposeBillRun(this.data.billId);
      // 奖惩
      if (this.data.billType === "JC")
        this.getDetailData.rewardRun(this.data.billId);
      // 销售代工开票申请
      if (this.data.billType === "DGHTKPSQ")
        this.getDetailData.oemContractInvoiceApplicationRun(this.data.billId);
      // 销售废料开票申请
      if (this.data.billType === "XSFLKPSQ")
        this.getDetailData.wasteSaleInvoiceApplicationRun(this.data.billId);
      // 业务部计划
      if (this.data.billType === "YWBZYJH")
        this.getDetailData.hardenedDailyPlanRun(this.data.billId);
      // 停工记录
      if (this.data.billType === "TGJL")
        this.getDetailData.acidStoppageRecordRun(this.data.billId);
      // 外储协议
      if (this.data.billType === "WCXY")
        this.getDetailData.outsideStorageProtocolRun(this.data.billId);
      // 主料合同开票申请
      if (this.data.billType === "CGHTFPSQ")
        this.getDetailData.materialContractInvoiceBillRun(this.data.billId);
      // 主料合同结算申请
      if (this.data.billType === "CGHTJSSQ")
        this.getDetailData.materialSettlementBillRun(this.data.billId);
      // 主料合同收款申请
      if (this.data.billType === "CGHTSKSQ")
        this.getDetailData.materialReceiptBillRun(this.data.billId);
      // 主料合同转款申请
      if (this.data.billType === "CGHTZKSQ")
        this.getDetailData.materialContractPaymentTransferBillRun(
          this.data.billId
        );
      // 主料合同付款申请
      if (this.data.billType === "CGHTFKSQ")
        this.getDetailData.paymentBillRun(this.data.billId);
      // 备品单位维护申请
      if (this.data.billType === "BPDWWH")
        this.getDetailData.spareUnitApplyRun(this.data.billId);
      // 二级项目维护申请
      if (this.data.billType === "EJXM")
        this.getDetailData.productionLineSubprojectApplyRun(this.data.billId);
      // 销售数据更改申请
      if (this.data.billType === "XSSJGGSQ")
        this.getDetailData.saleSpecChangeApplicationRun(this.data.billId);
      // 客户收款入账申请
      if (this.data.billType === "KHZHRZSQ")
        this.getDetailData.merchantPaymentBillRun(this.data.billId);
      // 客户退款申请
      if (this.data.billType === "KHZHTKSQ")
        this.getDetailData.refundBillBillRun(this.data.billId);
      // 客户额度申请
      if (this.data.billType === "KHZHEDSQ")
        this.getDetailData.creditLimitBillRun(this.data.billId);
      // 销售优惠回款
      if (this.data.billType === "XSYHHK")
        this.getDetailData.checkInitialRun(this.data.billId);
      // 销售优惠月结
      if (this.data.billType === "XSYHYJ")
        this.getDetailData.checkSalesPreferenceRun(this.data.billId);
      // 退轧硬铁桶
      if (this.data.billType === "TZYTT")
        this.getDetailData.returnIronBucketRun(this.data.billId);
      // 销售废料报废
      if (this.data.billType === "XSFLBF")
        this.getDetailData.wasteSaleScrapApplyBillRun(this.data.billId);
      // 废料开票记录
      if (this.data.billType === "FLKPJL")
        this.getDetailData.tradeWastesInvoiceRecordByRun(this.data.billId);
      // 备品发票录入
      if (this.data.billType === "BPFP")
        this.getDetailData.SpareInvoiceBillByRun(this.data.billId);
      // 采购凭证
      if (this.data.billType === "CGPZ")
        this.getDetailData.PurchaseProofBillRun(this.data.billId);
      // 发票录入申请
      if (this.data.billType === "FPLRSQ")
        this.getDetailData.SaleInvoiceBillRun(this.data.billId);
      /** 热卷开票记录*/
      if (this.data.billType === "RJKPJL")
        this.getDetailData.tradeReJuanInvoiceRecordByIDRun(this.data.billId);
      /** 打印申请查询 */
      if (this.data.billType === "DYSQ")
        this.getDetailData.getPrintData(this.data.billId);
	  /** 轧硬价格表审批 */
	  if (this.data.billType === "ZYJGSP")
	    this.getDetailData.getZhayingPriceAuditBillData(this.data.billId);
	  /** 轧硬取消预售单*/
	  if (this.data.billType === 'QXYSD') 
			this.getDetailData.saleCancelpresaleRun(this.data.billId);
    },
  },
  watch: {
    getDetailData: {
      handler(v) {
        for (const key in v || {}) {
          if (Object.hasOwnProperty.call(v, key)) {
            const element = v[key];
            if (typeof element == "object" && element.value) {
              this.dataOne = element;
              break;
            }
          }
        }
        uni.hideLoading();
        this.loading = false;
      },
      // immediate: true,
      deep: true,
    },
  },
};
</script>

<style lang="scss" scoped>
.todo {
  font-size: $uni-font-size-base !important;

  border-radius: 12px;

  border-radius: 12px;

  padding: 6px;
}

.progress-box {
  height: 50rpx;
  display: flex;
  // height: 50rpx;
  // margin-bottom: 60rpx;
}

.progress-cancel {
  margin-left: 40rpx;
}

.dialog {
  ::v-deep {
    .uni-section-header {
      padding: 12px 0;
    }

    .uni-dialog-content {
      display: block;

      uni-textarea {
        width: auto !important;
      }
    }
  }
}

.content {
  position: relative;
  padding-bottom: 50px;
}
</style>
